package com.zhang.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhang.mapper.IStudentMapper;
import com.zhang.pojo.Student;
import com.zhang.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl implements IStudentService {
    @Autowired
    private IStudentMapper studentMapper;

    @Override
    public PageInfo<Student> findByItem(int pageNo, String stuName, String schName) {
        PageHelper.startPage(pageNo,5);
        PageInfo<Student> studentPage = PageInfo.of(studentMapper.findByItem(stuName, schName));
        return studentPage;
    }

    @Override
    public void addStudent(Student student) {
        studentMapper.addStudent(student);
    }

    @Override
    public void update(int stuId, int classId, String phone) {
        studentMapper.update(stuId, classId, phone);
    }

    @Override
    public Student queryById(int stuId) {
        return studentMapper.queryById(stuId);
    }
    @Override
    public void del(int id) {
        studentMapper.del(id);
    }
}
